#include<iostream>
#include <cstdio>
#include <errno.h>
#include<unistd.h>
#include <cstdlib>
#include<sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>


const std::string gpipeFile = "./fifo";
const int gdefultfd = -1;
const int gmode = 0600;
const int gsize = 1024;
const int gForRead = O_RDONLY;
const int gForWrite = O_WRONLY;

int OpenPipe(int flag)
{
    int fd = ::open(gpipeFile.c_str(),flag);
    if(fd < 0)
    {
        perror("open");
        return 1;
    }

    return fd;
}

void ClosePipeHelper(int fd)
{
    if(fd >= 0)
        ::close(fd);
}

